<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="UTF-8"/>
        <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <title>理解SVG transform坐标变换</title>
        <style>
            svg, .svg {
                background-color: #f0f3f9;
            }
            .svg {
                width: 400px; height: 150px;
            }
            .rect {
                width: 120px; height: 90px;
                position: absolute;
                margin: 30px 0 0 30px;
                border-radius: 10px;
                background-color: #a0b3d6;
                background-image: linear-gradient(to bottom, #a0b3d6, #cad5eb);
            }
            .rotate {
                transform-origin: right bottom; /* 或者 100% 100% */
                transform:
                  rotate(90deg)
                  translate(0, -100%) /* 从右下到右上 */
                  rotate(90deg)
                  translate(0, 100%);
            }
        </style>
    </head>
    <body>
        <h1>理解SVG transform坐标变换</h1>
        <p><a href="https://www.zhangxinxu.com/wordpress/2015/10/understand-svg-transform/">来源</a></p>
        <p><strong>CSS3控制的的右下再右上旋转90度</strong></p>
        <div class="svg">
            <div class="rect rotate"></div>
        </div>
        <p><strong>SVG属性控制的右下再右上旋转90度</strong></p>
        <svg width="400" height="150">
            <defs>
                <linearGradient x1="0" y1="0" x2="0" y2="1" id="gradient">
                    <stop offset="0%" stop-color="#a0b3d6"></stop>
                    <stop offset="100%" stop-color="#cad5eb"></stop>
                </linearGradient>
            </defs>
            <rect x="30" y="30" width="120" height="90" rx="10" ry="10" fill="url('#gradient')" 
                transform="rotate(90, 150 120) rotate(90 150 30)"></rect>
        </svg>
    </body>
</html>